<?php if (!defined('SERVER_ROOT')) {exit('No direct script access allowed');}
//header
$this->template->title = 'Tra cứu cán bộ';
$this->template->display('dsp_header.php');

$v_MA_CAN_BO= $arr_filter['txt_MA_CAN_BO'];
$v_TEN_CAN_BO= $arr_filter['txt_TEN_CAN_BO'];
$v_CMND= $arr_filter['txt_CMND'];
$v_GIOI_TINH= $arr_filter['cbx_GIOI_TINH'];
$v_DC_THUONG_TRU= $arr_filter['txt_DC_THUONG_TRU'];
$v_DC_LIEN_LAC= $arr_filter['txt_DC_LIEN_LAC'];
$v_DT_CO_DINH= $arr_filter['txt_DT_CO_DINH'];
$v_DT_DI_DONG= $arr_filter['txt_DT_DI_DONG'];
$v_MA_DAN_TOC= $arr_filter['cbx_MA_DAN_TOC'];
$v_MA_TON_GIAO= $arr_filter['cbx_MA_TON_GIAO'];
$v_MA_HOC_HAM= $arr_filter['cbx_MA_HOC_HAM'];
$v_MA_HOC_VI= $arr_filter['cbx_MA_HOC_VI'];
$v_NGAY_VAO_DOAN= $arr_filter['txt_NGAY_VAO_DOAN'];
$v_NGAY_VAO_DANG= $arr_filter['txt_NGAY_VAO_DANG'];
$v_NGAY_KY_HD= $arr_filter['txt_NGAY_KY_HD'];
$v_NGAY_KET_THUC_HD= $arr_filter['txt_NGAY_KET_THUC_HD'];
?>
<form name="frmMain" id="frmMain" action="" method="POST" enctype="multipart/form-data">
  <?php
        echo $this->hidden('controller', $this->get_controller_url());
        $v_row=0;
    ?>
    <div style="text-align: center">
    <b>TRA CỨU DANH SÁCH CÁN BỘ</b>
     <select id="cbx_LOAI_TIM_KIEM"
            onchange="tracuu_click()"
            name="cbx_LOAI_TIM_KIEM">
     <option value="0" selected="selected">Đang công tác</option>
     <option value="1">Nghĩ hưu</option>
     <option value="2">Đang được đào tạo</option>
     <option value="3">Đang nghĩ thai sản</option>
     </select>
    </div>
       <br />
    <table id="tbl_timkiem" cellspacing='5px' cellpadding='2px'
           class="none-border-table"
           style="width: 100%; line-height: 200%">
		<tbody>
        <tr>
			<td width="14%">Mã cán bộ: </td>
			<td width="36%">
            <input type="text" data-doc="no" data-xml="no"
                   data-name="mã cán bộ" data-validate="text"
                   data-allownull="no" value="<?php echo $v_MA_CAN_BO; ?>"
                   style="width: 95%"  autofocus="autofocus"
                   onkeypress="txt_SEARCH_onkeypress(event);"
                   maxlength="20" id="txt_MA_CAN_BO" name="txt_MA_CAN_BO">
            </td>
           	<td width="14%">Tên cán bộ: </td>
			<td width="36%">
            <input type="text" data-doc="no" data-xml="no"
                   data-name="tên cán bộ" data-validate="text"
                   data-allownull="no" value="<?php  echo $v_TEN_CAN_BO; ?>"
                   style="width: 95%"
                   onkeypress="txt_SEARCH_onkeypress(event);"
                   maxlength="20" id="txt_TEN_CAN_BO" name="txt_TEN_CAN_BO">
            </td>
        </tr>
        <tr>
			<td>CMND: </td>
			<td>
            <input type="text" data-doc="no" data-xml="no"
                   data-name="CMND" data-validate="text"
                   data-allownull="no" value="<?php echo $v_CMND; ?>"
                   style="width: 95%"
                   onkeypress="txt_SEARCH_onkeypress(event);"
                   maxlength="9" id="txt_CMND" name="txt_CMND">
            </td>
            <td >Giới tính: </td>
			<td>
           <select id="cbx_GIOI_TINH"  name="cbx_GIOI_TINH">
                  <?php if($v_GIOI_TINH ==-1):?>
                     <option value="-1" selected="selected">Tất cả</option>
                     <option value="0" >Nam</option>
                     <option value="1">Nữ</option>
                  <?php elseif($v_GIOI_TINH ==0):?>
                     <option value="-1">Tất cả</option>
                     <option value="0" selected="selected">Nam</option>
                     <option value="1">Nữ</option>
                  <?php else:?>
                     <option value="-1">Tất cả</option>
                     <option value="0" >Nam</option>
                     <option value="1" selected="selected">Nữ</option>
                  <?php endif ?>

               </select>
            </td>

        </tr>
        <tr>
			<td >ĐC thường trú: </td>
			<td>
            <input type="text" data-doc="no" data-xml="no"
                   data-name="địa chỉ thường trú" data-validate="text"
                   data-allownull="no" value="<?php echo $v_DC_THUONG_TRU; ?>"
                   style="width: 95%"
                   onkeypress="txt_SEARCH_onkeypress(event);"
                   maxlength="11" id="txt_DC_THUONG_TRU" name="txt_DC_THUONG_TRU">
            </td>
           	<td>ĐC liên lạc: </td>
			<td>
            <input type="text" data-doc="no" data-xml="no"
                   data-name="địa chỉ liên lạc" data-validate="text"
                   data-allownull="no" value="<?php echo $v_DC_LIEN_LAC; ?>"
                   style="width: 95%"
                   onkeypress="txt_SEARCH_onkeypress(event);"
                   maxlength="100" id="txt_DC_LIEN_LAC" name="txt_DC_LIEN_LAC">
            </td>
        </tr>
        <tr>
			<td >ĐT cố định: </td>
			<td>
            <input type="text" data-doc="no" data-xml="no"
                   data-name="điện thoại cố định" data-validate="text"
                   data-allownull="no" value="<?php echo $v_DT_CO_DINH; ?>"
                   style="width: 95%"
                   onkeypress="txt_SEARCH_onkeypress(event);"
                   maxlength="11" id="txt_DT_CO_DINH" name="txt_DT_CO_DINH">
            </td>
           	<td>Di động: </td>
			<td>
            <input type="text" data-doc="no" data-xml="no"
                   data-name="điện thoại di động" data-validate="text"
                   data-allownull="no" value="<?php echo $v_DT_DI_DONG; ?>"
                   style="width: 95%"
                   onkeypress="txt_SEARCH_onkeypress(event);"
                   maxlength="100" id="txt_DT_DI_DONG" name="txt_DT_DI_DONG">
            </td>
        </tr>
        <tr>
			<td >Dân tộc: </td>
			<td>
            <select id="cbx_MA_DAN_TOC"  name="cbx_MA_DAN_TOC" style="width:96%">

                  <?php while ($arr = $arr_all_dantoc->FetchRow()): ?>
                  <?php
                   $MA_DAN_TOC_CBX=$arr['MA_DAN_TOC'];
                   $TEN_DAN_TOC_CBX=$arr['TEN_DAN_TOC'];
                  ?>
                   <?php if($v_MA_DAN_TOC ==$MA_DAN_TOC_CBX):?>
                     <option value="<?php echo $MA_DAN_TOC_CBX; ?>" selected="selected"><?php echo $TEN_DAN_TOC_CBX; ?></option>
                  <?php else:?>
                     <option value="<?php echo $MA_DAN_TOC_CBX; ?>" ><?php echo $TEN_DAN_TOC_CBX; ?></option>
                  <?php endif ?>
                  <?php endwhile; ?>
             </select>
            </td>
           	<td>Tôn giáo: </td>
			<td>
            <select id="cbx_MA_TON_GIAO"  name="cbx_MA_TON_GIAO" style="width:96%">

                  <?php while ($arr = $arr_all_tongiao->FetchRow()): ?>
                  <?php
                   $MA_TON_GIAO_CBX=$arr['MA_TON_GIAO'];
                   $TEN_TON_GIAO_CBX=$arr['TEN_TON_GIAO'];
                  ?>
                   <?php if($v_MA_TON_GIAO ==$MA_TON_GIAO_CBX):?>
                     <option value="<?php echo $MA_TON_GIAO_CBX; ?>" selected="selected"><?php echo $TEN_TON_GIAO_CBX; ?></option>
                  <?php else:?>
                     <option value="<?php echo $MA_TON_GIAO_CBX; ?>" ><?php echo $TEN_TON_GIAO_CBX; ?></option>
                  <?php endif ?>
                  <?php endwhile; ?>
             </select>
             </td>
        </tr>
        <tr>
			<td >Học hàm: </td>
			<td>
            <select id="cbx_MA_HOC_HAM"  name="cbx_MA_HOC_HAM" style="width:96%">

                  <?php while ($arr = $arr_all_hocham->FetchRow()): ?>
                  <?php
                   $MA_HOC_HAM_CBX=$arr['MA_HOC_HAM'];
                   $TEN_HOC_HAM_CBX=$arr['TEN_HOC_HAM'];
                  ?>
                   <?php if($v_MA_HOC_HAM ==$MA_HOC_HAM_CBX):?>
                     <option value="<?php echo $MA_HOC_HAM_CBX; ?>" selected="selected"><?php echo $TEN_HOC_HAM_CBX; ?></option>
                  <?php else:?>
                     <option value="<?php echo $MA_HOC_HAM_CBX; ?>" ><?php echo $TEN_HOC_HAM_CBX; ?></option>
                  <?php endif ?>
                  <?php endwhile; ?>
             </select>
            </td>
            <td>Học vị: </td>
			<td>
            <select id="cbx_MA_HOC_VI"  name="cbx_MA_HOC_VI" style="width:96%">

                  <?php while ($arr = $arr_all_hocvi->FetchRow()): ?>
                  <?php
                   $MA_HOC_VI_CBX=$arr['MA_HOC_VI'];
                   $TEN_HOC_VI_CBX=$arr['TEN_HOC_VI'];
                  ?>
                   <?php if($v_MA_HOC_VI ==$MA_HOC_VI_CBX):?>
                     <option value="<?php echo $MA_HOC_VI_CBX; ?>" selected="selected"><?php echo $TEN_HOC_VI_CBX; ?></option>
                  <?php else:?>
                     <option value="<?php echo $MA_HOC_VI_CBX; ?>" ><?php echo $TEN_HOC_VI_CBX; ?></option>
                  <?php endif ?>
                  <?php endwhile; ?>
             </select>
            </td>
        </tr>

        <tr>
			<td >Ngày vào đoàn: </td>
			<td>
            <input type="text" data-doc="no" data-xml="no"
                   data-name="ngày vào đoàn" data-validate="text"
                   data-allownull="no" value="<?php echo $v_NGAY_VAO_DOAN; ?>"
                   style="width: 80%"
                   onkeypress="txt_SEARCH_onkeypress(event);"
                   maxlength="20" id="txt_NGAY_VAO_DOAN" name="txt_NGAY_VAO_DOAN">
             <img class="btndate" style="cursor:pointer" id="btnDate" src="<?php echo SITE_ROOT; ?>public/images/calendar.gif" onclick="DoCal('txt_NGAY_VAO_DOAN')">
           </td>
           	<td>Ngày vào đảng: </td>
			<td>
            <input type="text" data-doc="no" data-xml="no"
                   data-name="CMND" data-validate="text"
                   data-allownull="no" value="<?php  echo $v_NGAY_VAO_DANG; ?>"
                   style="width: 80%"
                   onkeypress="txt_SEARCH_onkeypress(event);"
                   maxlength="20" id="txt_NGAY_VAO_DANG" name="txt_NGAY_VAO_DANG">
            <img class="btndate" style="cursor:pointer" id="btnDate" src="<?php echo SITE_ROOT; ?>public/images/calendar.gif" onclick="DoCal('txt_NGAY_VAO_DANG')">
            </td>
        </tr>
        <tr>
			<td >Ngày ký HĐ: </td>
			<td>
            <input type="text" data-doc="no" data-xml="no"
                   data-name="ngày ký hợp đồng" data-validate="text"
                   data-allownull="no" value="<?php echo $v_NGAY_KY_HD; ?>"
                   style="width: 80%"
                   onkeypress="txt_SEARCH_onkeypress(event);"
                   maxlength="20" id="txt_NGAY_KY_HD" name="txt_NGAY_KY_HD">
              <img class="btndate" style="cursor:pointer" id="btnDate" src="<?php echo SITE_ROOT; ?>public/images/calendar.gif" onclick="DoCal('txt_NGAY_KY_HD')">
            </td>
           	<td>Ngày kết thúc HĐ: </td>
			<td>
            <input type="text" data-doc="no" data-xml="no"
                   data-name="ngày kết thúc hợp đồng" data-validate="text"
                   data-allownull="no" value="<?php echo $v_NGAY_KET_THUC_HD; ?>"
                   style="width: 80%"
                   onkeypress="txt_SEARCH_onkeypress(event);"
                   maxlength="20" id="txt_NGAY_KET_THUC_HD" name="txt_NGAY_KET_THUC_HD">
              <img class="btndate" style="cursor:pointer" id="btnDate" src="<?php echo SITE_ROOT; ?>public/images/calendar.gif" onclick="DoCal('txt_NGAY_KET_THUC_HD')">
           </td>
        </tr>
      	</tbody>
      </table>
       <div style="text-align: center;margin-top: 10px;">
          <input onclick="tracuu_click()" id="btn_add_hoso" type="button" accesskey="2"  value="Tra cứu" class="button" name="update">
          <input onclick="xoahet_click()" id="btn_add_hoso" type="button" accesskey="2"  value="Xóa hết" class="button" name="update">
       </div>
<table width="100%" class="adminlist" cellspacing="0" border="1">
        <colgroup>
            <col width="10%">
            <col width="17%">
            <col width="15%">
            <col width="15%">
            <col width="15%">
            <col width="5%">
            <col width="23%">
        </colgroup>
        <tbody>
        <tr>
            <th>Mã cán bộ</th>
            <th>Họ tên</th>
            <th>Ngày sinh</th>
            <th>Ngày ký HĐ</th>
            <th>Tên ngạch</th>
            <th>HSL</th>
            <th>Chức vụ</th>
        </tr>
        <?php  while ($arr = $arr_all_canbo->FetchRow()): ?>
            <?php
             $MA_CAN_BO=$arr['MA_CAN_BO'];
             $TEN_CAN_BO=$arr['TEN_CAN_BO'];
             $NGAY_SINH=$arr['NGAY_SINH2'];
             $NGAY_KY_HD=$arr['NGAY_KY_HD2'];
             $TEN_BAC_NGACH_HIEN_TAI=$arr['TEN_BAC_NGACH_HIEN_TAI'];
             $HE_SO_LUONG_HIEN_TAI=$arr['HE_SO_LUONG_HIEN_TAI'];
             $CHUC_VU_HIEN_TAI=$arr['CHUC_VU_HIEN_TAI'];
             $v_row++;
             $v_class = 'row' . ($v_row % 2);
             $v_link = SITE_ROOT . 'qlcb/canbo/dsp_single_canbo/&m=' . $MA_CAN_BO;
            ?>
            <tr class="<?php echo $v_class;?>">
                <td style="text-align:center"><?php echo $MA_CAN_BO;?> </td>
                <td><?php echo $TEN_CAN_BO;?></td>
                <td style="text-align:center"><?php echo $NGAY_SINH;?></td>
                <td style="text-align:center"><?php echo $NGAY_KY_HD;?></td>
                <td><?php echo $TEN_BAC_NGACH_HIEN_TAI;?></td>
                <td style="text-align:center"><?php echo $HE_SO_LUONG_HIEN_TAI;?></td>
                <td><?php echo $CHUC_VU_HIEN_TAI;?></td>
                <td></td>
            </tr>
        <?php endwhile; ?>
        <?php echo $this->add_empty_rows($v_row +1, _CONST_DEFAULT_ROWS_PER_PAGE, 7); ?>
</table>
</form>
<script>

    function search_trangthai_click(trangthaihoso){
        var f = document.frmMain;
        //f.hdn_TYPE_filter.value =  'MA_THU_TUC';
        //f.hdn_TRANG_THAI_HO_SO_filter.value =  trangthaihoso;
        f.submit();
    }

    function txt_SEARCH_onkeypress(evt){
        if (IE()){
            theKey=window.event.keyCode
        }else{
            theKey=evt.which;
        }
        if(theKey == 13){
            var f = document.frmMain;
            //f.hdn_TYPE_filter.value =  'MA_THU_TUC';
            f.submit();
        }
        return false;
    }
    function xoahet_click(){
        $("#txt_MA_CAN_BO").val('');
        $("#txt_TEN_CAN_BO").val('');
        $("#txt_CMND").val('');
        $("#cbx_GIOI_TINH").val('-1');
        $("#txt_DC_THUONG_TRU").val('');
        $("#txt_DC_LIEN_LAC").val('');
        $("#txt_DT_CO_DINH").val('');
        $("#txt_DT_DI_DONG").val('');
        $("#cbx_MA_DAN_TOC").val('');
        $("#cbx_MA_TON_GIAO").val('');
        $("#cbx_MA_HOC_HAM").val('');
        $("#cbx_MA_HOC_VI").val('');
        $("#txt_NGAY_VAO_DOAN").val('');
        $("#txt_NGAY_VAO_DANG").val('');
        $("#txt_NGAY_KY_HD").val('');
        $("#txt_NGAY_KET_THUC_HD").val('');
    }
    function tracuu_click(){
        var f = document.frmMain;
        //f.hdn_TYPE_filter.value =  'MA_THU_TUC';
        f.submit();
    }
</script>
<?php $this->template->display('dsp_footer.php');